//package com.dykj.fireFighting.web.mq.producer;
//
//import lombok.Data;
//
//import org.apache.rocketmq.client.producer.DefaultMQProducer;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//
///**
// * @Author fgc
// * @Date 2021/9/27 9:37
// * @ Description：生产者配置类
// */
//@Data
//@Configuration
//public class MyMQProducerConfig {
////    public static final Logger LOGGER = LoggerFactory.getLogger(MyMQProducerConfig.class);
////
////
////    @Value("${rocketmq.producer.groupName}")
////    private String groupName;
////    @Value("${rocketmq.producer.namesrvAddr}")
////    private String namesrvAddr;
////    /**
////     * 消息最大大小，默认4M
////     */
////    @Value("${rocketmq.producer.maxMessageSize}")
////    private Integer maxMessageSize ;
////    /**
////     * 消息发送超时时间，默认3秒
////     */
////    @Value("${rocketmq.producer.sendMsgTimeOut}")
////    private Integer sendMsgTimeout;
////    /**
////     * 消息发送失败重试次数，默认2次
////     */
////    @Value("${rocketmq.producer.retryTimesWhenSendFailed}")
////    private Integer retryTimesWhenSendFailed;
////
////    @Bean
////    public DefaultMQProducer getRocketMQProducer() throws Exception {
////
////
////
////        DefaultMQProducer producer;
////        producer = new DefaultMQProducer(this.groupName);
////        producer.setNamesrvAddr(this.namesrvAddr);
////        //如果需要同一个jvm中不同的producer往不同的mq集群发送消息，需要设置不同的instanceName
////        //producer.setInstanceName(instanceName);
////        if(this.maxMessageSize!=null){
////            producer.setMaxMessageSize(this.maxMessageSize);
////        }
////        if(this.sendMsgTimeout!=null){
////            producer.setSendMsgTimeout(this.sendMsgTimeout);
////        }
////        //如果发送消息失败，设置重试次数，默认为2次
////        if(this.retryTimesWhenSendFailed!=null){
////            producer.setRetryTimesWhenSendFailed(this.retryTimesWhenSendFailed);
////        }
////
////        try {
////            producer.start();
////
////            LOGGER.info(String.format("producer is start ! groupName:[%s],namesrvAddr:[%s]"
////                    , this.groupName, this.namesrvAddr));
////        } catch (Exception e) {
////            LOGGER.error(String.format("producer is error {}"
////                    , e.getMessage(),e));
////            throw new Exception(e);
////        }
////        return producer;
////    }
//}
